 rollout progress "detach faces" width:372 height:40
 (
 	progressBar pro "ProgressBar" pos:[4,26] width:362 height:9 color:(color 255 0 0) orient:#horizontal
 	label pro2 "" pos:[120,4] width:140 height:18
 
 ) 
 
 
 createdialog progress  
		 
		 

		 detachobj=gobj2
         converttomesh detachobj
	     obj2=copy detachobj
		 obj3=copy detachobj

		 obj2numface=obj2.numfaces 
		 
		 for v = 1 to obj2.numfaces do
	        (
	          ConvertToMesh obj2
	          newMesh = meshop.detachFaces obj2 #{1} delete:true asMesh:true
	          update obj2 
	          emesh = Editable_mesh() 
	          emesh.mesh = newMesh 
	          update emesh           
	          emesh.transform = obj2.transform
	          null=dummy()
			  actrl = Attachment() 
	          null.position.controller = actrl 
	          actrl.node = detachobj
			  addNewKey actrl 0f 
	          theAKey = AttachCtrl.getKey actrl 1
	          theAKey.face =v-1
	          theAKey.coord = [0.3,0.3]
	          emesh.parent=null
			  hide null
	        
			
	          ConvertToMesh obj3
	          newMesh = meshop.detachFaces obj3 #{1} delete:true asMesh:true
	          update obj3 
	          emesh2 = Editable_mesh() 
	          emesh2.mesh = newMesh 
	          update emesh2          
	          emesh2.transform = obj3.transform
			  emesh2.name="OObject" + v as string	
			  progress.pro.value=v*100./obj2numface
              pro2=(v*100/obj2numface) as integer			
			  progress.pro2.text="processing:" + pro2 as string + "%"
			
			
			)

		  	
delete obj2
progress.pro.value=0
DestroyDialog progress
		 

	 
		 
		 